#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void solve() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	cout << max(a[n - 1], n) << endl;
}

int main() {
	int t;
	cin >> t;
	while (t-- > 0) {
		solve();
	}
	return 0;
}
